<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>JpetStore后台管理</title>
    <link rel="stylesheet" href="../../css/backstage.css" type="text/css"/>
    <script th:src = "@{/JS/jquery-3.2.1.js}"></script>
    <script th:src = "@{/JS/jquery-ui.js}"></script>
</head>
<body>
<div th:replace="/administrator/common/head.html"></div>
<div class="mid">

            <form action="/catalog/updateItem" method="post" id="editItemTable" enctype="multipart/form-data">
                <div>
                    <a href="/catalog/AdminViewItem">返回到商品总览(记得保存修改)</a>
                </div>
                <table>
                <tr>
                    <td>商品类型:</td>
                    <td><input type="text" readonly="readonly" style="outline:none; width: 100px" th:value="${item.getProduct().getCategoryId()}"></td>
                </tr>
                <tr>
                    <td>产品类型:</td>
                    <td><input type="text" readonly="readonly" style="outline:none; width: 100px" th:value="${item.getProduct().getProductId()}" name="productId"></td>
                </tr>
                <tr>
                    <td>图片信息:<br/><a class="updata_file" id="alter_image"><u>更改照片</u></a></td>
                    <td><img th:src="${item.getProduct().getImages()}" style="width: 200px;height: 200px" id="imageview"></td>

                        <input type="file" id="fileupload" style="display: none" name="upload" disabled="disabled">

                </tr>
                <tr>
                    <td>宠物ID:</td>
                    <td><input type="text" readonly="readonly" style="outline:none; width: 100px" th:value="${item.getItemId()}" name="itemId">
                    </td>
                </tr>
                <tr>
                    <td>单价:</td>
                    <td><input type="text"  style="width: 100px" th:value="${item.getListPrice()}" name="listPrice" required="required">
                    </td>
                </tr>
                <tr>
                    <td>成本:</td>
                    <td><input type="text"  style="width: 100px" th:value="${item.getUnitCost()}" name="unitCost" required="required">
                    </td>
                </tr>
                <tr>
                    <td>库存</td>
                    <td><input type="text"  style="width: 100px" th:value="${item.getSupplierId()}" name="supplierId" required="required" id="supplierId">
                    </td>
                    <td id="supperError"></td>
                </tr>
                <tr>
                    <td>状态：</td>
                    <td>
                    <select name="status" th:id="${item.getItemId()}">
                    </select>
                    </td>
                    <script th:inline="javascript">
                        /*<![CDATA[*/
                        var status1 = document.getElementById(/*[[${item.getItemId()}]]*/)
                        if("P" == /*[[${item.getStatus()}]]*/){
                            var opt = document.createElement("option");
                            opt.value="P";
                            opt.innerHTML="出售";
                            opt.selected=true;
                            status1.appendChild(opt);
                            var opt1 = document.createElement("option");
                            opt1.value="NP";
                            opt1.innerHTML="暂不出售";
                            status1.appendChild(opt1);
                        }
                        else{
                            var opt = document.createElement("option");
                            opt.value="P";
                            opt.innerHTML="出售";
                            status1.appendChild(opt);
                            var opt1 = document.createElement("option");
                            opt1.value="NP";
                            opt1.innerHTML="暂不出售";
                            opt1.selected=true;
                            status1.appendChild(opt1);
                        }
                        /*]]>*/
                    </script>
                </tr>
                <tr>
                    <td>产品描述:</td>
                    <td>
                        <input th:value="${item.getAttribute1()}" type="text" name="attribute1" style="width: 120px" required="required">
                    </td>
                </tr>
                </table>
                <td>
                <input type="submit" style="font-size: 16px;" value="保存"></td>
                <td><a th:href="@{'/catalog/deleteItem?itemId='+${item.getItemId()}}">删除该产品</a>
                </td>
                <script th:src="@{/JS/administrator/catalog/EditItem.js}"></script>
            </form>
</div>
<div th:replace="/administrator/common/foot.html"></div>
</body>
</html>